/*
语法百题 解题报告：
 http://git.oschina.net/et0662/sznoi-grammar/ 
*/
#include<stdio.h>

int main(void)
{
	char bc,nc;
	int count=0;
	bc=' ';
	while(1)
	{
		scanf("%c",&nc);
		if(nc=='.')
			break;
		if((bc==' ') && (nc!=' ' ))
			count++;
		bc=nc;
	}
	printf("%d\n",count);
	return 0;
}
